package com.spider.pool;

import java.util.concurrent.*;

/**
 * @author β世界
 * Created on 14:38
 * @Description 爬虫的线程池实现器
 */
public class SpiderThreadPoolExecute extends ThreadPoolExecutor {

    public SpiderThreadPoolExecute(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
    }

    public SpiderThreadPoolExecute(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
    }

    public SpiderThreadPoolExecute(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
    }

    public SpiderThreadPoolExecute(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
    }

    /**
     * @author β世界 on 14:40 2020/9/3
     * 当执行的任务彻底结束的时候，会调用
     *
     **/
    @Override
    protected void terminated() {
        super.terminated();
    }

    /**
     * @author β世界 on 15:06 2020/9/3
     * 在执行任务前的方法
     * @param t: 线程对象
     * @param r: 线程的任务方法
     * @return void
     **/
    @Override
    protected void beforeExecute(Thread t, Runnable r) {
        super.beforeExecute(t,r);
    }

    /**
     * @author β世界 on 15:09 2020/9/3
     * 当线程的任务执行结束后
     * @param r: 线程任务对象
     * @param t: 导致线程终止的异常，如果没有异常抛出，那么这个就是Null
     * @return void
     **/
    @Override
    protected void afterExecute(Runnable r, Throwable t) {
        super.afterExecute(r,t);
    }
}
